package com.mgl.util;

import java.io.IOException;
import java.io.InputStream;

import org.andengine.opengl.texture.ITexture;
import org.andengine.opengl.texture.TextureManager;
import org.andengine.opengl.texture.bitmap.BitmapTexture;
import org.andengine.util.adt.io.in.IInputStreamOpener;

import android.content.res.AssetManager;

public final class Util {

	/**
	 * mafm
	 * @param nameTexture
	 * @return
	 */
	public final static ITexture loadTexture(String nameTexture, TextureManager textureManager, final AssetManager assetManager){
		ITexture iTexture = null;
		try {
			iTexture = new BitmapTexture(
					textureManager, new IInputStreamOpener() {
						@Override
						public InputStream open() throws IOException {
							return assetManager.open("gfx/background.png");
						}
					});
			iTexture.load();
			return iTexture;
		} catch (Exception e) {
			e.printStackTrace();
			return iTexture;
		}
		
	}
	
}
